<%@page import="pl.org.waff.WaffServlet"%>
<%@page import="pl.org.waff.PathElement"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="sitenavigator" class="pl.org.waff.DefaultNavigator" scope="application" />
<jsp:useBean id="applicationprefix" class="java.lang.String" scope="application" />
<%  String currentPath = WaffServlet.getCurrentPath((String) request.getAttribute(WaffServlet.PATH_ATTRIBUTE_NAME));
    String rootPath = (String) request.getSession().getAttribute(WaffServlet.PATH_PREFIX_ATTRIBUTE_NAME);
    if (rootPath == null) {
        rootPath = "";
    }else if(rootPath.endsWith("/")){
        rootPath=rootPath.substring(0,rootPath.length()-1);
    }
%>
Subpages: <br/>
&nbsp;<br/>
<%
    ArrayList children2;
    if (sitenavigator != null) {
        children2 = sitenavigator.getChildren(currentPath.substring(rootPath.length()));
        PathElement pe;
        for (int i = 0; i < children2.size(); i++) {
            pe = (PathElement) children2.get(i);
            if (pe != null) {
                out.print("<a href='" + applicationprefix + rootPath + pe.getPath() + "'>" + pe.getName() + "</a><br/>");
            }
        }
        if (children2.size() == 0) {
            out.print("---");

        }
    }

%>